home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Microsoft Plateform / Visual Basic 5.0 / Msvb50.ace / msvb50 / MSVB50 / VB / REPOSTRY / INCLUDE / REPAPI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-23  |  8.0 KB  |  253 lines

  1. //*****************************************************************************
  2. // REPAPI.H
  3. //
  4. // This module contains some of the key GUID declarations for the Repository,
  5. // as well as the error handling definitions.  The actual API can be found
  6. // in the .odl generated repauto.h file.
  7. //
  8. // Copyright (c) 1995-1996 by Microsoft Corporation, All Rights Reserved
  9. //*****************************************************************************
  10. #ifndef __REPAPI_H__
  11. #define __REPAPI_H__
  12. #include "repauto.h"                    // Repository OLE automation interfaces
  13. #include "reperr.h"                        // Repository Error definitions.
  14.  
  15.  
  16. // {EA43C550-2CFD-11d0-9236-00AA00A1EB95}
  17. DEFINE_GUID(CLSID_RClassImplIface, 
  18. 0xea43c550, 0x2cfd, 0x11d0, 0x92, 0x36, 0x0, 0xaa, 0x0, 0xa1, 0xeb, 0x95);
  19.  
  20. // {EA43C551-2CFD-11d0-9236-00AA00A1EB95}
  21. DEFINE_GUID(CLSID_RIfaceInheritsFromIface, 
  22. 0xea43c551, 0x2cfd, 0x11d0, 0x92, 0x36, 0x0, 0xaa, 0x0, 0xa1, 0xeb, 0x95);
  23.  
  24. // {EA43C552-2CFD-11d0-9236-00AA00A1EB95}
  25. DEFINE_GUID(CLSID_RIfaceHasMembers, 
  26. 0xea43c552, 0x2cfd, 0x11d0, 0x92, 0x36, 0x0, 0xaa, 0x0, 0xa1, 0xeb, 0x95);
  27.  
  28. // {EA43C553-2CFD-11d0-9236-00AA00A1EB95}
  29. DEFINE_GUID(CLSID_RColContainsItems, 
  30. 0xea43c553, 0x2cfd, 0x11d0, 0x92, 0x36, 0x0, 0xaa, 0x0, 0xa1, 0xeb, 0x95);
  31.  
  32. // {EA43C554-2CFD-11d0-9236-00AA00A1EB95}
  33. DEFINE_GUID(CLSID_RContainerContextForReposTLBs, 
  34. 0xea43c554, 0x2cfd, 0x11d0, 0x92, 0x36, 0x0, 0xaa, 0x0, 0xa1, 0xeb, 0x95);
  35.  
  36. // {EA43C555-2CFD-11d0-9236-00AA00A1EB95}
  37. DEFINE_GUID(CLSID_RReposTLBScopeForReposTypeInfo, 
  38. 0xea43c555, 0x2cfd, 0x11d0, 0x92, 0x36, 0x0, 0xaa, 0x0, 0xa1, 0xeb, 0x95);
  39.  
  40.  
  41. // {A4FD30F6-0B49-11cf-9208-00AA00A1EB95}
  42. DEFINE_GUID(IID_IIntRepos, 
  43. 0xa4fd30f6, 0xb49, 0x11cf, 0x92, 0x8, 0x0, 0xaa, 0x0, 0xa1, 0xeb, 0x95);
  44.  
  45. // {847D1A61-BA79-11cf-8AE8-00A0C90541B2}
  46. DEFINE_GUID(IID_IReposErrorQueueHandler, 
  47. 0x847d1a61, 0xba79, 0x11cf, 0x8a, 0xe8, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0xb2);
  48.  
  49. // {53200701-BB06-11cf-8AE8-00A0C90541B2}
  50. DEFINE_GUID(IID_IRepositoryErrorQueue, 
  51. 0x53200701, 0xbb06, 0x11cf, 0x8a, 0xe8, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0xb2);
  52.  
  53. // {D4429821-5825-11cf-88A5-00AA006FF9A0}
  54. DEFINE_GUID(IID_IEnumRepositoryErrors, 
  55. 0xd4429821, 0x5825, 0x11cf, 0x88, 0xa5, 0x0, 0xaa, 0x0, 0x6f, 0xf9, 0xa0);
  56.  
  57. // Constant size values.
  58. const int RELSHIPNAMESIZE        = 260;    // Max size of a relship name.
  59. const int MEMBERNAMESIZE        = 128;    // Max property name.
  60. const int PROPVALSIZE            = 220;  // Max annotational property value.
  61. const int TABLENAMESIZE            = 32;
  62. const int COLUMNNAMESIZE        = 32;
  63. const int TYPEINFONAMESIZE        = 128;
  64. const int TYPELIBNAMESIZE        = 64;
  65. const int USERSIZE                = 64;
  66. const int PASSWORDSIZE            = 64;
  67.  
  68.  
  69. // Internal repository object IDs.
  70. struct INTID
  71. {
  72.     ULONG        iSiteID;
  73.     ULONG        iLocalID;
  74. };
  75. typedef const INTID &REFINTID;
  76.  
  77. // Some useful overloaded operators.
  78. inline BOOL operator==(const INTID& One, const INTID& Other)
  79. {
  80.     return (One.iLocalID == Other.iLocalID &&
  81.             One.iSiteID == Other.iSiteID);
  82. }
  83.  
  84. inline BOOL operator!=(const INTID& One, const INTID& Other)
  85. {
  86.     return (One.iLocalID != Other.iLocalID ||
  87.             One.iSiteID != Other.iSiteID);
  88. }
  89.  
  90. inline BOOL operator>(const INTID& One, const INTID& Other)
  91. {
  92.     return (memcmp(&One, &Other, sizeof(INTID)) > 0);
  93. }
  94.  
  95. inline BOOL operator<(const INTID& One, const INTID& Other)
  96. {
  97.     return (memcmp(&One, &Other, sizeof(INTID)) < 0);
  98. }
  99.  
  100. inline int Compare(const INTID& One, const INTID& Other)
  101. {
  102.     return (memcmp(&One, &Other, sizeof(INTID)));
  103. }
  104.  
  105. inline BOOL operator==(IRepositoryObject &One, IRepositoryObject &Two)
  106. {
  107.     BOOL        bSame;
  108.     VARIANT        sOne, sTwo;
  109.     HRESULT        hr;
  110.     ::VariantInit(&sOne);
  111.     ::VariantInit(&sTwo);
  112.     if (FAILED(hr = One.get_InternalID(&sOne)) ||
  113.         FAILED(hr = Two.get_InternalID(&sTwo)))
  114.         return (FALSE);
  115.     bSame = *(INTID*)sOne.parray->pvData == *(INTID*)sTwo.parray->pvData;
  116.     ::VariantClear(&sOne);
  117.     ::VariantClear(&sTwo);
  118.     return (bSame);
  119. }
  120.  
  121. inline BOOL operator!=(IRepositoryObject &One, IRepositoryObject &Two)
  122. {
  123.     return (!(One == Two));
  124. }
  125.  
  126.  
  127. //*****************************************************************************
  128. // Repository object IDs are represented as a GUID identifying where they
  129. // were created plus a 4 byte identifier unique to that location.
  130. //*****************************************************************************
  131. typedef OBJECTID OBJID;
  132. typedef const OBJID& REFOBJID;
  133.  
  134. // This defines the instantiation of the object IDs.
  135. #ifndef INITGUID
  136. #define DEFINE_OBJID(name, u, guid) \
  137.     EXTERN_C const OBJID CDECL FAR name
  138. #else
  139. #define DEFINE_OBJID(name, u, guid) \
  140.     EXTERN_C const OBJID CDECL __based(__segname("_CODE")) name \
  141. = { guid, u }
  142. #endif // INITGUID
  143.  
  144. // Some useful overloaded operators.
  145. inline BOOL operator==(const OBJID& objidOne, const OBJID& objidOther)
  146. {
  147.     return !memcmp(&objidOne,&objidOther,sizeof(OBJID));
  148. }
  149. inline BOOL operator!=(const OBJID& objidOne, const OBJID& objidOther)
  150. {
  151.     return !(objidOne == objidOther);
  152. }
  153.  
  154.  
  155.  
  156. // Forwards...
  157. interface IReposErrorHandler;
  158.  
  159. //*****************************************************************************
  160. // These flags are returned in an REPOSERROR struct in the fFlags field.
  161. //*****************************************************************************
  162. #define REPOSERROR_OBJKNOWN        0x00000001L    // Object ID is known.
  163. #define REPOSERROR_SQLINFO        0x00000002L    // SQL error information is valid.
  164. #define REPOSERROR_HELPAVAIL    0x00000004L // rcHelpFile and dwHelpContext valid.
  165.  
  166. #define REPOSERROR_MSG_SIZE        256
  167.  
  168. //*****************************************************************************
  169. // Defines one error that has occured in repsonse to a Repository method call.
  170. //*****************************************************************************
  171. struct REPOSERROR
  172. {
  173.     ULONG        iSize;                    // Size of this struct.
  174.     ULONG        fFlags;                    // REPOSERROR_* flags.
  175.     HRESULT        hr;                        // The error code.
  176.     TCHAR        rcMsg[REPOSERROR_MSG_SIZE];    // Message text.
  177.     TCHAR        rcHelpFile[_MAX_PATH];    // The name of the help file
  178.     ULONG        dwHelpContext;            // Help context for error.
  179.     long        iNativeError;            // Supplied by database, if applicable.
  180.     TCHAR        rcSqlState[6];            // Supplied by database, if applicable.
  181.     short        iReserved;                // For Repository use only.
  182.     OBJID        sObjID;                    // OBJID in error.
  183.     GUID        clsid;                    // CLSID of object with the error.
  184.     GUID        iid;                    // Interface with error or GUID_NULL.
  185. };
  186.  
  187. //*****************************************************************************
  188. // This interface is used to enumerate extended error information.
  189. //*****************************************************************************
  190. interface IEnumRepositoryErrors : public IUnknown
  191. {
  192.     STDMETHOD(Next)(
  193.         ULONG        iCount,
  194.         REPOSERROR    *psErrors,
  195.         ULONG        *piFetched) = 0;
  196.  
  197.     STDMETHOD(Next)(
  198.         IErrorInfo    **ppIErrorInfo) = 0;
  199.  
  200.     STDMETHOD(Skip)(
  201.         ULONG        iCount) = 0;
  202.  
  203.     STDMETHOD(Reset)() = 0;
  204.  
  205.     STDMETHOD(Clone)(
  206.         IEnumRepositoryErrors **ppIEnum) = 0;
  207. };
  208.  
  209.  
  210. //*****************************************************************************
  211. // This interface is used to perform operations on the error queue. 
  212. //*****************************************************************************
  213. interface IRepositoryErrorQueue : public IUnknown
  214. {
  215.     STDMETHOD(Insert)(
  216.         ULONG        iIndex,
  217.         REPOSERROR    *psError) = 0;
  218.  
  219.     STDMETHOD(Remove)(
  220.         ULONG        iIndex) = 0;
  221.  
  222.     STDMETHOD_(ULONG, Count)() = 0;
  223.  
  224.     STDMETHOD(Item)(
  225.         ULONG        iIndex,
  226.         REPOSERROR    *psError) = 0;
  227.  
  228.     STDMETHOD(Item)(
  229.         ULONG        iIndex,
  230.         IErrorInfo    **ppIErrorInfo) = 0;
  231.  
  232.     STDMETHOD(_NewEnum)(
  233.         IEnumRepositoryErrors **ppIEnum) = 0; 
  234. };
  235.  
  236. //*****************************************************************************
  237. // This interface is used to handle the error queue. 
  238. //*****************************************************************************
  239. interface IReposErrorQueueHandler : public IUnknown
  240. {
  241.     STDMETHOD(CreateErrorQueue)(
  242.         IRepositoryErrorQueue    **ppIErrorQueue) = 0;
  243.  
  244.     STDMETHOD(SetErrorQueue)(
  245.         IRepositoryErrorQueue    *pIErrorQueue) = 0;
  246.  
  247.     STDMETHOD(GetErrorQueue)(
  248.         IRepositoryErrorQueue    **ppIErrorQueue) = 0;
  249. };
  250.  
  251.  
  252. #endif // __REPAPI_H__
  253.